package com.example.xpvideo.Controller;


import com.example.xpvideo.annotations.Public;
import com.example.xpvideo.entity.ResponseResult;
import com.example.xpvideo.entity.req.LoginByPwdReq;
import com.example.xpvideo.entity.res.LoginRes;
import com.example.xpvideo.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : 洪俊新
 * @date :  2021/4/25-17:18
 * @module b2b后台
 */
@RestController
@RequestMapping("/back/phpauth")
public class AuthControl {
    @Autowired
    private AuthService authService;

    /**
     * 后台账号密码登录
     * @param loginByPwdReq the login by pwd req
     * @return the response result
     * @throws Exception the exception
     */
    @PostMapping("/loginByPwd")
    @Public
    public ResponseResult<LoginRes> loginByPwd(@RequestBody @Validated
                                                       LoginByPwdReq loginByPwdReq) throws Exception {
        return authService.loginByPwd(loginByPwdReq);
    }
}
